from os import listdir
from os.path import isfile, join
import os
import pathlib

if __name__ == "__main__":
    path=str(input("请输入目录: "))
    filenames = [f for f in listdir(path) if isfile(join(path, f))]
    suffix=str(input("请输入新后缀: "))
    for filename in filenames:
        filename = os.path.abspath(str(path) + '/' + filename)
        print(filename)
        portion = os.path.splitext(filename)
        newName = portion[0] + "." + suffix.strip(".")
        os.rename(filename, newName)
			